<!DOCTYPE html>
<html>
  <head>
  	<meta charset="utf-8" />
    <title>Iscore</title>
    <LINK rel="stylesheet" type="text/css" href="style/accueil.css">
	<script src="./js/lib/jquery-1.9.1.min.js"></script>
	<script src="./js/accueil.js"></script>

	<script>
		$(document).ready(function() {
			afficheInfos();
		});
	</script>
  </head>
  
  <body>
  		<header>
  			<div id ="haut_page_gauche">
				<img src="./style/logo/IScore.png"alt="IScore"/>
			</div>
			<div id ="haut_page_milieu">
	 
<?php
require_once 'class/include.php';
require_once ('sessionManager.php');

$currentUser = User::get($_SESSION['userId']);
$prenom = $currentUser->getPrenom();
$nom = $currentUser->getNom();
echo '<p>Bonjour'.' '.$prenom.' '.$nom.'</p>';
?>

			</div>
			<div id ="haut_page_droite">
				<p><a href="logout.php">Se déconnecter</a></p>
			</div>
			<div id ="haut_page_droite_help">
				<a href="userManual.pdf" target="_blank"><img src="./style/logo/help.png" height="20px"/></a>
			</div>
	  	</header>
	  	<div id="contenu">
		 	<div id="contenu_partitions">
				<h3>Mes partitions</h3>
				<div id="partitions">
				
<?php
$partitions = Partition::getAll();
$insts = Instrument::getAll();
$user =  1;//for test

foreach($partitions as $index => $partition) {
	$partId = $partition->getId();
	echo '<div id="partition'.$partId.'" class="partition">';
	$partAuteur = $partition->getAuteur();
	echo '<p class="groupe">'.$partAuteur.'</p>';
	$partNom = $partition->getNom();
	echo '<p class="chanson">'.$partNom.'</p>';
	$concert = $partition->getConcert();
	echo '<p class="instrument">';

	if (!is_null($concert)){
			$userInstConcerts = $concert->getListUserinstrumentconcertWhereconcertId(
				array(
					0=>array('field'=>'user',
					'operator'=>'=',
					'value'=>$_SESSION['userId']
				) 
			));
		if (sizeof($userInstConcerts) == 1){
			$instId = $userInstConcerts[0]->getInstrument();
			if (!is_null($instId)){			
				echo $instId->getNom();
			}			
		}
	}
	echo '</p>';
	echo '</div>';	
}
?>

		  		</div>
		  	</div>
		  	<div id="detail">
				<h3></h3><h2></h2>
				<div id="info_detail">
					<div>
						<p class="champs">Groupe:<span class="groupe"></span></p>						
					</div>
					<div>
						<p class="champs">Mon instrument:<span class="instrument"></span></p>
					</div>
					<div>
						<p class="champs">Musiciens:</p>
						<ul id="musiciens">
						<!--
						    <li>Chef d'orchestre : Mahdi Laribi</li>
						    <li>Chef violon : Thierry Maestre</li>
						    <li>Violoncelle : Glen Rhodes</li>
						    <li>Guitare : Sylvain Collin</li>
						 	<li>Guitare : Ludovic Renaux</li>
							-->
						</ul>
					</div>
					<div id="bouton_jouer" >
					  <p>
					   <a class="bouton" id="btn_jouer" href='#'>Jouer</a>
					 </p>
					</div>

		  		</div>
		  	</div>	
	  	</div>
  </body>
</html>